<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="angular.js"></script>
    <!-- 最新版的bootstrap 核心 css 文件-->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <title>中奖名单</title>
    <style>
        body{
            /*background: #E43327;*/
        }
    </style>
</head>
<body>
<div class="container" ng-app="gg" ng-controller="ctrl">
    <h2 class="text-center">中奖名单</h2>
    <table class="table table-bordered table-hover">
        <thead>
        <tr class="info">
            <th>序号</th>
            <th>手机号</th>
            <th>奖项</th>
            <th>中奖时间</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="(k,v) in data" ng-show="v.ticket != 0">
            <td>{{v.id}}</td>
            <td>{{v.phone}}</td>
            <td ng-if="v.ticket == 1">一等奖</td>
            <td ng-if="v.ticket == 2">二等奖</td>
            <td ng-if="v.ticket == 3">三等奖</td>
            <td>{{v.addtime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
        </tr>
        <tr ng-repeat="(k,v) in data" ng-show="v.ticket == 0">
            <td>{{v.id}}</td>
            <td>{{v.phone}}</td>
            <td>未中奖</td>
            <td>{{v.addtime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
        </tr>
        </tbody>
    </table>
</div>

<script>
    var mod = angular.module('gg', []);
    mod.controller('ctrl', ['$scope', '$filter' ,'$http', function ($scope, $filter, $http) {
//        $scope.time = new Date().getTime();
        $http({
            method:'get',
            url:'http://count.zijinshan.org/count/ulist.php'
        }).then(function (data) {
//            console.log(data);
            $scope.data = data.data
            $scope.data = $filter('orderBy')($scope.data, 'ticket');
            // console.log($scope.data)
        },function (data) {
            // console.log(data)
        })
    }])
</script>
</body>
</html>